package nc.ui.bd.mes.dxyapp.myswing.panels;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import nc.ui.bd.mes.dxyapp.myswing.MyPanel;
import nc.ui.bd.mes.dxyapp.utils.UIAdapter;

public class TabPanel extends JPanel {
	String tabname;
	/**
	 * Create the panel.
	 */
	JTabbedPane jTabbedPane;
	JLabel label;
	MyPanel myPanel;
	public TabPanel(JTabbedPane pane,String tabName) {
		jTabbedPane = pane;
		label = new JLabel(tabName);
		tabname = tabName;
		JButton button = new JButton("x");
		add(label,BorderLayout.WEST);
		add(button,BorderLayout.EAST);
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				UIAdapter.cancelTab(TabPanel.this);
			}
		});
	}
	
	public void setMypanel(MyPanel myPanel){
		this.myPanel = myPanel;
	}
	
	public MyPanel getMypanel(){
		return myPanel;
	}
	
	public JLabel getLabel(){
		return label;
	}
}
